<?php
namespace Admin\Controller;
use Think\Controller;
class UnlimitedController extends Controller {

    public function login(){
    	if(IS_POST) {
    		$post = I('post.');
    		$post['is_delete'] = 1;
    		$post['password']  = md5($post['password']);
    		$user = M('user')->where($post)->find();
    		if(empty($user)) {
    			$this->error('用户名或密码错误');
    		}
    		session('admin_user_id', $user['id']);
    		$this->success('登录成功', U('Index/index'));
    	} else {
    		$this->display('User/login');
    	}
    	
    }

    public function logout() {
    	session('admin_user_id', null);
    	$this->success('您已经退出管理平台', U('login'));
    }

}